package com.example.rabbitmq.rabbit.object;

import com.example.rabbitmq.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/19 22:38
 */
@Component
@Slf4j
public class ObjectSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;
    public void send(User user) {
        log.info("Sender object: {}" , user.toString());
        this.rabbitTemplate.convertAndSend("object", user);
    }
}
